import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk7/pPD5ZkOarTKjfJkjJ\n' +
  'CQI7Hj70uEwmKVCbZ3sKKj90WyVkQtPiZTTvoS4NqTEp4y/RUSg6gTAnWuVdoFa6\n' +
  'lhLuhHVo1Ul0QgYUhE1MKsEASKsijiWTTd2Zpjpt0gH8JubHoD/6CbD+Jp3+0QzK\n' +
  'j4n166+C3IOPo7wzgeI99z2Ii28OlL6SPySaK3Nws2UqbQABupmpHIB3D/BWocD4\n' +
  'erlS9ALgGoIe/Bd2fR0WK7Y8ZQoQUNlBgOqzj6HwjY+ntiSUr9/9tEOcWLSBB9lX\n' +
  'xmC+30eMNYuYeejbhC0Dn8rqua0w6YXwpO+WYAt7wR5K1cKt3LDKwYXFpgfWWKKn\n' +
  '0wIDAQAB'

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}

